<?php
// +-------------------------------------------------------------------
// |
// +-------------------------------------------------------------------
// | Copyright (c) 2009-2016 All rights reserved.
// +-------------------------------------------------------------------
namespace Service\Api\V1;

class CollectCancel
{
    public $login = true; //是否需要登录才能访问该接口
    public $title = "收藏取消ok";
    public $group = '收藏';
    public $desc = "";

    public $input = [
        'ids' => 'required;string;label=收藏id;comment=多个使用英文逗号分隔;',
    ];

    public $output = [

    ];

    public function run($param, $uid)
    {
        $ret = M('user_collect')
            ->where([
                'uid' => $uid,
                'id' => ['in', $param['ids']],
            ])
            ->delete();
        if($ret){
            return true;
        }else{
            throw new \Exception('取消失败');
        }

    }
}
